using System.Data;
using ET;

namespace DA
{
    public class Department_DAL
    {
        private clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Department(string keywords)
        {
            return cls.Search("sp_tb_Department_Search", "@KEYWORDS", keywords);
        }
        //public DataTable BindGirdtb_DepartmentDetail(int id)
        //{

        //}
        #endregion

        #region Insert
        public bool Inserttb_Department(Department_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Department_Name", data.Department_Name);
            cls.AddParameter("@Department_Note", data.Department_Note);
            cls.ExecuteNonQuery("sp_tb_Department_Insert");
            return true;
        }
        #endregion

        #region Update
        public bool Updatetb_Department(Department_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Department_Id", data.Department_Id);
            cls.AddParameter("@Department_Name", data.Department_Name);
            cls.AddParameter("@Department_Note", data.Department_Note);
            cls.ExecuteNonQuery("sp_tb_Department_Update");
            return true;
        }
        #endregion

        #region Delete
        public bool Deletetb_Department(int id)
        {
            cls.Delete("sp_tb_Department_Delete", "@Department_Id", id);
            return true;
        }
        #endregion
    }
}